import { Column, CreateDateColumn, UpdateDateColumn, Entity, OneToMany } from "typeorm";
import { BaseEntity } from "@/common/entities/base.entity";
import { ChaptersEntity } from "./chapters.entity"
@Entity('book')
export class BookEntity extends BaseEntity {
  @Column({ name: 'name', comment: '名称' })
  name: string;

  @Column({ name: 'author', nullable: true, comment: '作者' })
  author: string;

  @Column({ name: 'description', nullable: true, comment: '书籍简介' })
  description: string;

  @OneToMany(() => ChaptersEntity, (chapter) => chapter.book)
  chapters: ChaptersEntity[];
}
